/*
 * @Author: wuzhouhai wzh200x@126.com
 * @Date: 2024-07-30 16:02:41
 * @LastEditors: wuzhouhai wzh200x@126.com
 * @LastEditTime: 2024-08-07 10:27:31
 * @FilePath: \dwys_web\assets\script\phoenix\messageHandle\s2cRoomPmtUpLevel_MessageHandle.ts
 * @Description: 
 */
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { IMessageHandle } from "../../../../extensions/phoenix-plugin-client/assets/core/interface/IMessageHandle";
import messageManager from "../../../../extensions/phoenix-plugin-client/assets/core/managers/message.manager";
import { GameEvent } from "../../common/event/GameEvent";
import { OpcodeApp } from "../define/opcode.define";
import * as proto from "../protoc/ts/proto_app.js";

export default class S2CRoomPmtUpLevel implements IMessageHandle{
    handleMessage(msgData: any): void {
        let response = msgData as proto.s2c_UpRoomPmtLevel;
        console.log("S2CRoomPmtUpLevel", response);
        if (response.base!.code == 0) {
            oops.message.dispatchEvent(GameEvent.UpdateRoomPmt, response.roomPmtInfo);
            oops.message.dispatchEvent(GameEvent.AddGameMsgInfo, "房间ID [" + response.roomPmtInfo!.roomId + "], 摆件[" + response.roomPmtInfo!.name + 
            "] 升级成功] 当前等级 lv." + response.roomPmtInfo!.pmtLevel); 
        }else{
            oops.message.dispatchEvent(GameEvent.AddGameMsgInfo, "摆件升级失败 [" + response.base!.msg + "]" );
        }
    }
}

messageManager.registerHandle(OpcodeApp.Opcode_SC_ROOM_PMT_UP_LEVEL, new S2CRoomPmtUpLevel());